<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import type { TabsPaneContext } from 'element-plus'
import { RouterView } from 'vue-router';
import { useRouter } from 'vue-router';

//获取路由器对象
const router=useRouter()
const activeName = ref('first')
onMounted(()=>{
  router.push('/index/statistics/workload/workload1')
})
const handleClick = (tab: TabsPaneContext, event: Event) => {
  console.log(tab.props.label)
  if(tab.props.label=='检查项目列表'){
  //跳转到主页面组件
  router.push('/index/statistics/workload/workload1')
  }

  if(tab.props.label=='检查项目统计列表'){
  //跳转到主页面组件
  router.push('/index/statistics/workload/workload2')
  }
}
</script>
<template>
  <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick" :stretch="true">
      <el-tab-pane label="检查项目列表" name="first"></el-tab-pane>
      <el-tab-pane label="检查项目统计列表" name="second"></el-tab-pane>
  </el-tabs>
  <RouterView></RouterView>
</template>

<style scoped></style>
